﻿Public Class frmPatrocinador

    Dim bd As New BTTbdDataContext

    Private codPatrocinador As String
    Private nomPatrocinador As String

    Private Sub PatrocinadorBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
      
    End Sub

    Private Sub btnSeleccionar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        'codmedico = dgvPersonal.CurrentRow.Cells("codigo").Value
        codPatrocinador = Me.dgvPatrocinador.CurrentRow.Cells("idPatrocinador").Value.ToString
        nomPatrocinador = Me.dgvPatrocinador.CurrentRow.Cells("nombre").Value.ToString
        'nomMedico = dgvPersonal.CurrentRow.Cells("nombre").Value.ToString _
        '+ dgvPersonal.CurrentRow.Cells("apepat").Value.ToString _
        '+ " " + dgvPersonal.CurrentRow.Cells("apemat").Value.ToString

        Me.Close()
    End Sub

    Private Sub frmPatrocinador_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'BTTbdDataSet.contacto' table. You can move, or remove it, as needed.

        Dim patrocinadores = From patrocinador In bd.patrocinadors _
                             Select patrocinador

        Me.PatrocinadorBindingSource.DataSource = patrocinadores
    End Sub

    Private Sub PatrocinadorBindingNavigatorSaveItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PatrocinadorBindingNavigatorSaveItem.Click
        Try
            bd.SubmitChanges()
            MsgBox("Saved")
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

    Public Property _nomPatrocinador()
        Get
            Return Me.nomPatrocinador
        End Get
        Set(ByVal value)
            nomPatrocinador = value
        End Set
    End Property

    Public Property _codPatrocinador()
        Get
            Return Me.codPatrocinador
        End Get
        Set(ByVal value)
            codPatrocinador = value
        End Set
    End Property

    Private Sub btnSeleccionar_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSeleccionar.Click

        codPatrocinador = Me.dgvPatrocinador.CurrentRow.Cells("idPatrocinador").Value.ToString
        nomPatrocinador = Me.dgvPatrocinador.CurrentRow.Cells("nombre").Value.ToString
        Me.Close()
    End Sub
End Class